package com.uaijug.dengue.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ErrorServlet extends HttpServlet {

	private static final long serialVersionUID = -8226428125266071729L;

	@Override
	protected void service(HttpServletRequest req, HttpServletResponse res)
			throws ServletException, IOException {
		String message = (String) req
				.getAttribute("javax.servlet.error.message");

		PrintWriter out = res.getWriter();
		out.write("<html>");
		out.write("<body>");
		out.write("<h1>An error has occurred</h1>");
		out.write("<br />" + message);
		out.write("</body>");
		out.write("</html>");
	}
}
